<template>
	<view class="warp">
		<view style="padding-bottom: 30rpx;padding-left: 30rpx;">
			<u--image :src="'https://health-wanglijie.oss-cn-hangzhou.aliyuncs.com/uni_img/'+imgUrl"
			 mode="widthFix" :lazy-load="true"></u--image>
		</view>
		<view class="content1">
			<u--text :text="setmeal.name" style="padding: 30rpx;"></u--text>
			<u--text :text="setmeal.remark" style="padding: 30rpx;padding-top: 0;"></u--text>
			<view style="display: flex;flex-direction: row;padding: 30rpx;padding-top: 0;" >
				<u--text :text="setmeal.age" type="warning"></u--text>
				<u--text :text="setmeal.sex == '0' ? '性别不限' : setmeal.sex == '1' ? '男':'女'" 
				type="warning"></u--text>
			</view>
		</view>
		<u-divider text="---"></u-divider>
		<view class="content2">
			<u--text text="套餐详情" size="20" :bold="true"></u--text>
		</view>
		<view class="content3">
			<u-row customStyle="margin-bottom: 10px">
				<u-col span="4">
					<u--text class="title" text="项目名称" size="20"></u--text>
				</u-col>
				<u-col span="4">
					<u--text class="title" text="项目内容" size="20"></u--text>
				</u-col>
				<u-col span="4">
					<u--text class="title" text="项目解读" size="20"></u--text>
				</u-col>
			</u-row>
			<u-row customStyle="margin-bottom: 20px" v-for="(item,index) in setmeal.checkGroups" :key="index">
				<u-col span="4">
					<u--text :text="item.name"></u--text>
				</u-col>
				<u-col span="4">	
					<u--text :text="checkitem.name" v-for="(checkitem,index) in item.checkItems" :key="checkitem.name"></u--text>
				</u-col>
				<u-col span="4">
					<u--text :text="item.remark"></u--text>
				</u-col>
				<u-divider lineColor="#2979ff"></u-divider>
			</u-row>
		</view>
		<u-button type="primary" text="确定预约" style="margin-top: 30rpx;width: 670rpx;" @click="navTo"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				imgUrl:null,//套餐对应的图片链接
				setmeal:{}
			}
		},
		methods: {
			navTo(){
				// uni.$emit("setOrder",{ghg:'sss'})
				
				// setInterval(function(){
				// 	,1000)
				// })
				// console.log(this.id)
				uni.navigateTo({
					url:"/pages/orderInfo/orderInfo?id="+this.id
				})
				
			}
		},
		computed:{
			
		},
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option.id); //打印出上个页面传递的参数。
			this.id = option.id
			uni.request({
				url:"/api/setmeal/findById.do",
				data:{
					id:option.id
				},
				success: (res) => {
					// console.log(res.data)
					this.setmeal = res.data.data
					this.imgUrl = res.data.data.img
					// console.log(this.setmeal)
					this.$store.dispatch("setSetmeal",this.setmeal)
					// console.log(JSON.stringify(this.$store.state.setmeal))
				}
			})
			
			
			// console.log("hhh")
			// uni.$off("setOrder",function(){
			// 	console.log("结束监听")
			// })
		}
	}
</script>

<style scoped>
	.warp{
		padding: 30rpx;
		display: flex;
		justify-content: center;
		flex-direction: column;
	},
	.content1{
		padding: 30rpx;
		background: #d3dce6;
		border-radius: 25rpx;
		width: 600rpx;
		height: 230rpx;
	}
	.content2 {
		padding: 30rpx;
		background: #d3dce6;
		border-radius: 25rpx;
		width: 600rpx;
		height: 100rpx;
	}
	.content3{
		padding: 30rpx;
		margin-top: 30rpx;
		background: #d3dce6;
		width: 600rpx;
		height: auto;
	}
</style>
